<%@page import="com.fishing.util.DateUtil"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!doctype html>
<html>
<head>
<title>线下充值文本描述</title>
<base href="<%=basePath%>" />
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="renderer" content="webkit">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="stylesheet" href="layui/css/layui.css" media="all" />
</head>
<%
	String today = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
%>
<body>
    <br/>
    <form class="layui-form" >
    <div class="contents">
    <div class="layui-form-item layui-form-text">
	    <label class="layui-form-label" style="color:red">充值文本</label>
	    <div class="layui-input-block">
	      <textarea name="contents" id="contents" placeholder="请输入文本描述" class="layui-textarea"></textarea>
	    </div>
    </div>
    </div>
    <div class="btn">
        <label class="layui-form-label"></label>
		<button class="layui-btn" lay-submit lay-filter="go">发送</button>
		<button type="reset" class="layui-btn layui-btn-primary">重置</button>
	</div>
    </form>
    
    <!-- 充值文本表格 -->
    <table class="layui-table" lay-skin="nob" id="describeTable" lay-filter="describeTable"></table>
    
	<script src="js/jquery.min.js"></script>
	<script src="layui/layui.js" charset="utf-8"></script>
	<script>
	layui.use(['layer','form','table'], function () {
        var layer = layui.layer, 
            form = layui.form,
            table = layui.table;
        
        form.on('submit(go)', function () {
        	$.ajax({
        		type:'post',
        		url:"rechargedescribe/add",
        		data:{contents:$("#contents").val()},
        		success:function(data){
            	    if(data == "success"){
            			layer.msg("充值文本描述发布成功",{icon:1});
            			setTimeout(function(){
            				table.reload('AllTable', {});
            				window.location.reload();
            			},1000);
        			}else{
        				layer.msg(data,{icon:2});
        			}
        		},error:function(){
        			layer.msg("充值文本描述发布失败");
        		}
        	});
          return false;
        });
        
        table.render({
			elem : '#describeTable',
			url : 'rechargedescribe/list',
			method : 'post',
			title : '充值文本描述',
			totalRow : true,
			id:'AllTable',
			cols : [ [ 
				{field : 'ConfigString',title : '充值文本描述',style:"color:red"}, 
				] ],
			page : false,//分页
			response : {
				statusCode : 200
			//重新规定成功的状态码为 200，table 组件默认为 0
			},
			parseData : function(res) { //将原始数据解析成 table 组件所规定的数据
				return {
					"code" : res.status, //解析接口状态
					"msg" : res.message, //解析提示文本
					"count" : res.count, //解析数据长度
					"data" : res.data
				//解析数据列表
				};
			}
		});
        });
    </script>
	
	
</body>
</html>